﻿

layui.use(['table','form'], function(){
    var form = layui.form;
    form.on('submit(sendData)', function(data){
        layer.confirm('确认修改?', {icon: 3, title:'警告'}, function(index) {
            var a=GetRequest();
            var tableid=a['tableId'];
            var typeId=a['typeId'];
            var index=0;
            var jsonArr = new Array(13);
            var jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 1;
            jsonIndex['num'] = isEmpty($('#pm_num').val());
            jsonIndex['money'] = isEmpty($('#pm_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#pm_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#pm_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 2;
            jsonIndex['num'] = isEmpty($('#jszx_num').val());
            jsonIndex['money'] = isEmpty($('#jszx_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#jszx_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#jszx_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 3;
            jsonIndex['num'] = isEmpty($('#app_designer_num').val());
            jsonIndex['money'] = isEmpty($('#app_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#app_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#app_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 4;
            jsonIndex['num'] = isEmpty($('#platform_designer_num').val());
            jsonIndex['money'] = isEmpty($('#platform_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#platform_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#platform_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 5;
            jsonIndex['num'] = isEmpty($('#client_designer_num').val());
            jsonIndex['money'] = isEmpty($('#client_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#client_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#client_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 6;
            jsonIndex['num'] = isEmpty($('#web_designer_num').val());
            jsonIndex['money'] = isEmpty($('#web_designer_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#web_designer_day').val());
            jsonIndex['totalDay'] = isEmpty($('#web_designer_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 7;
            jsonIndex['num'] = isEmpty($('#ui_designer_num').val());
            jsonIndex['money'] = isEmpty($('#ui_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#ui_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#ui_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 8;
            jsonIndex['num'] = isEmpty($('#java_designer_num').val());
            jsonIndex['money'] = isEmpty($('#java_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#java_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#java_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 9;
            jsonIndex['num'] = isEmpty($('#andriod_designer_num').val());
            jsonIndex['money'] = isEmpty($('#andriod_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#andriod_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#andriod_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 10;
            jsonIndex['num'] = isEmpty($('#web_designer_2_num').val());
            jsonIndex['money'] = isEmpty($('#web_designer_2_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#web_designer_2_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#web_designer_2_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 11;
            jsonIndex['num'] = isEmpty($('#App_designer_num').val());
            jsonIndex['money'] = isEmpty($('#App_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#App_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#App_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 12;
            jsonIndex['num'] = isEmpty($('#C_designer_num').val());
            jsonIndex['money'] = isEmpty($('#C_designer_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#C_designer_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#C_designer_total_day').val());
            jsonArr[index++] = jsonIndex;

            jsonIndex = {};
            jsonIndex['level1SystemId'] = tableid;
            jsonIndex['typeId'] = typeId;
            jsonIndex['site'] = 13;
            jsonIndex['num'] = isEmpty($('#test_num').val());
            jsonIndex['money'] = isEmpty($('#test_money_per_day').val());
            jsonIndex['planDay'] = isEmpty($('#test_plan_day').val());
            jsonIndex['totalDay'] = isEmpty($('#test_total_day').val());
            jsonArr[index++] = jsonIndex;

            index--;

            console.log(JSON.stringify(jsonArr));

            $.ajax({
                type:'post',
                dateType: "json",
                contentType : "application/json",
                url:"/contract/saveSystem2Data",
                data:JSON.stringify(jsonArr),
                success: function (res) {
                    console.log(res)
                    if(res.msg == 'success') {
                        layer.msg("修改成功！ 页面即将关闭！ ");
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        setTimeout(
                            function(){
                                parent.layer.close(index);//关闭弹出的子页面窗口*!/
                            },1000)
                    } else {
                        layer.msg('修改失败');
                    }
                }
            });
            layer.close(index);
        });
        return false;
    });
});



function initData(tableid, typeid, status){
    $.ajax({
        type:'get',
        dataType: "json",
        url:"/contract/findSystem2Data",
        data:{
                level1SystemId: tableid,
                typeId: typeid
            },
        success:function(res){
            console.log(res);
            if(res.msg == 'success') {
                setData(res.data.system2Data,status);
            } else {
                alert('失败');
            }
        }
    });
}
function GetRequest() {
    var url = location.search; //获取url中"?"符后的字串
    //console.log(url);
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}
function setData(info,status){
    for(var i = 0; i < info.length; i++){
        console.log(info[i]);
        switch(info[i].site) {
            case 1 : $('#pm_num').val(info[i].num); break;
            case 2 : $('#jszx_num').val(info[i].num); break;
            case 3 : $('#app_designer_num').val(info[i].num); break;
            case 4 : $('#platform_designer_num').val(info[i].num); break;
            case 5 : $('#client_designer_num').val(info[i].num); break;
            case 6 : $('#web_designer_num').val(info[i].num); break;
            case 7 : $('#ui_designer_num').val(info[i].num); break;
            case 8 : $('#java_designer_num').val(info[i].num); break;
            case 9 : $('#andriod_designer_num').val(info[i].num); break;
            case 10: $('#App_designer_num').val(info[i].num); break;
            case 11 : $('#C_designer_num').val(info[i].num); break;
            case 12 : $('#web_designer_2_num').val(info[i].num); break;
            case 13 : $('#test_num').val(info[i].num); break;
        }
    }
    setTimeout(
        function(){
            var evtObj = document.createEvent('UIEvents');
            evtObj.initUIEvent('input', true, true, window, 1 );
            for(var i = 0; i < info.length; i++){
                switch(info[i].site) {
                    case 1 : setPmData(info[i], evtObj); break;
                    case 2 : setJszxData(info[i], evtObj); break;
                    case 3 : setappDesignerData(info[i], evtObj); break;
                    case 4 : setPlatformDesignerData(info[i], evtObj); break;
                    case 5 : setClientDesignerData(info[i], evtObj); break;
                    case 6 : setWebDesignerData(info[i], evtObj); break;
                    case 7 : setUiDesignerData(info[i], evtObj); break;
                    case 8 : setJavaDesignerData(info[i], evtObj); break;
                    case 9 : setAndriodDesignerData(info[i], evtObj); break;
                    case 10 : setAppDesignerData(info[i], evtObj); break;
                    case 11 : setCDesignerData(info[i], evtObj); break;
                    case 12 : setWebDesigner2Data(info[i], evtObj); break;
                    case 13 : setTestData(info[i], evtObj); break;
                }
            }
            setDisabled(status);
        });
}
function setPmData(info, evtObj){
    document.querySelector("#pm_num").dispatchEvent(evtObj);
    if($('#pm_money').length > 0)  {
        $('#pm_money_per_day').val(info.money);
        $('#pm_total_day').val(info.totalDay);
        $('#pm_plan_day').val(info.planDay);
    }
}
function setJszxData(info, evtObj){
    document.querySelector("#jszx_num").dispatchEvent(evtObj);
    if($('#jszx_money').length > 0)  {
        $('#jszx_money_per_day').val(info.money);
        $('#jszx_total_day').val(info.totalDay);
        $('#jszx_plan_day').val(info.planDay);
    }
}
function setappDesignerData(info, evtObj){
    document.querySelector("#app_designer_num").dispatchEvent(evtObj);
    if($('#app_designer_money').length > 0)  {
        $('#app_designer_money_per_day').val(info.money);
        $('#app_designer_total_day').val(info.totalDay);
        $('#app_designer_plan_day').val(info.planDay);
    }
}
function setPlatformDesignerData(info, evtObj){
    document.querySelector("#platform_designer_num").dispatchEvent(evtObj);
    if($('#platform_designer_money').length > 0)  {
        $('#platform_designer_money_per_day').val(info.money);
        $('#platform_designer_total_day').val(info.totalDay);
        $('#platform_designer_plan_day').val(info.planDay);
    }
}
function setClientDesignerData(info, evtObj){
    document.querySelector("#client_designer_num").dispatchEvent(evtObj);
    if($('#client_designer_money').length > 0)  {
        $('#client_designer_money_per_day').val(info.money);
        $('#client_designer_total_day').val(info.totalDay);
        $('#client_designer_plan_day').val(info.planDay);
    }
}
function setCDesignerData(info, evtObj){
    document.querySelector("#C_designer_num").dispatchEvent(evtObj);
    if($('#C_designer_money').length > 0)  {
        $('#C_designer_money_per_day').val(info.money);
        $('#C_designer_total_day').val(info.totalDay);
        $('#C_designer_plan_day').val(info.planDay);
    }
}
function setWebDesignerData(info, evtObj){
    document.querySelector("#web_designer_num").dispatchEvent(evtObj);
    if($('#web_designer_money').length > 0)  {
        $('#web_designer_money_per_day').val(info.money);
        $('#web_designer_total_day').val(info.totalDay);
        $('#web_designer_plan_day').val(info.planDay);
    }
}
function setUiDesignerData(info, evtObj){
    document.querySelector("#ui_designer_num").dispatchEvent(evtObj);
    if($('#ui_designer_money').length > 0)  {
        $('#ui_designer_money_per_day').val(info.money);
        $('#ui_designer_total_day').val(info.totalDay);
        $('#ui_designer_plan_day').val(info.planDay);
    }
}
function setJavaDesignerData(info, evtObj){
    document.querySelector("#java_designer_num").dispatchEvent(evtObj);
    if($('#java_designer_money').length > 0)  {
        $('#java_designer_money_per_day').val(info.money);
        $('#java_designer_total_day').val(info.totalDay);
        $('#java_designer_plan_day').val(info.planDay);
    }
}
function setAndriodDesignerData(info, evtObj){
    document.querySelector("#andriod_designer_num").dispatchEvent(evtObj);
    if($('#andriod_designer_money').length > 0)  {
        $('#andriod_designer_money_per_day').val(info.money);
        $('#andriod_designer_total_day').val(info.totalDay);
        $('#andriod_designer_plan_day').val(info.planDay);
    }
}
function setWebDesigner2Data(info, evtObj){
    document.querySelector("#web_designer_2_num").dispatchEvent(evtObj);
    if($('#web_designer_2_money').length > 0)  {
        $('#web_designer_2_money_per_day').val(info.money);
        $('#web_designer_2_total_day').val(info.totalDay);
        $('#web_designer_2_plan_day').val(info.planDay);
    }
}
function setAppDesignerData(info, evtObj){
    document.querySelector("#App_designer_num").dispatchEvent(evtObj);
    if($('#App_designer_money').length > 0)  {
        $('#App_designer_money_per_day').val(info.money);
        $('#App_designer_total_day').val(info.totalDay);
        $('#App_designer_plan_day').val(info.planDay);
    }
}

function setTestData(info, evtObj){
    document.querySelector("#test_num").dispatchEvent(evtObj);
    if($('#test_money').length > 0)  {
        $('#test_money_per_day').val(info.money);
        $('#test_total_day').val(info.totalDay);
        $('#test_plan_day').val(info.planDay);
    }
}

function setDisabled(status){
    //console.log('setDisabled='+status);
    if(status==1) {
        // alert('设置禁用....');
        $('#button_store').hide();
        $('#pm_num').attr("disabled","disabled");
        $('#pm_money_per_day').attr("disabled","disabled");
        $('#pm_total_day').attr("disabled","disabled");
        $('#pm_plan_day').attr("disabled","disabled");
        $('#jszx_num').attr("disabled","disabled");
        $('#jszx_money_per_day').attr("disabled","disabled");
        $('#jszx_total_day').attr("disabled","disabled");
        $('#jszx_plan_day').attr("disabled","disabled");
        $('#app_designer_num').attr("disabled","disabled");
        $('#app_designer_money_per_day').attr("disabled","disabled");
        $('#app_designer_total_day').attr("disabled","disabled");
        $('#app_designer_plan_day').attr("disabled","disabled");
        $('#platform_designer_num').attr("disabled","disabled");
        $('#platform_designer_money_per_day').attr("disabled","disabled");
        $('#platform_designer_total_day').attr("disabled","disabled");
        $('#platform_designer_plan_day').attr("disabled","disabled");
        $('#client_designer_num').attr("disabled","disabled");
        $('#client_designer_money_per_day').attr("disabled","disabled");
        $('#client_designer_total_day').attr("disabled","disabled");
        $('#client_designer_plan_day').attr("disabled","disabled");
        $('#web_designer_num').attr("disabled","disabled");
        $('#web_designer_money_per_day').attr("disabled","disabled");
        $('#web_designer_total_day').attr("disabled","disabled");
        $('#web_designer_plan_day').attr("disabled","disabled");
        $('#ui_designer_num').attr("disabled","disabled");
        $('#ui_designer_money_per_day').attr("disabled","disabled");
        $('#ui_designer_total_day').attr("disabled","disabled");
        $('#ui_designer_plan_day').attr("disabled","disabled");
        $('#java_designer_num').attr("disabled","disabled");
        $('#java_designer_money_per_day').attr("disabled","disabled");
        $('#java_designer_total_day').attr("disabled","disabled");
        $('#java_designer_plan_day').attr("disabled","disabled");
        $('#App_designer_num').attr("disabled","disabled");
        $('#App_designer_money_per_day').attr("disabled","disabled");
        $('#App_designer_total_day').attr("disabled","disabled");
        $('#App_designer_plan_day').attr("disabled","disabled");
        $('#andriod_designer_num').attr("disabled","disabled");
        $('#andriod_designer_money_per_day').attr("disabled","disabled");
        $('#andriod_designer_total_day').attr("disabled","disabled");
        $('#andriod_designer_plan_day').attr("disabled","disabled");
        $('#C_designer_num').attr("disabled","disabled");
        $('#C_designer_money_per_day').attr("disabled","disabled");
        $('#C_designer_total_day').attr("disabled","disabled");
        $('#C_designer_plan_day').attr("disabled","disabled");
        $('#web_designer_2_num').attr("disabled","disabled");
        $('#web_designer_2_money_per_day').attr("disabled","disabled");
        $('#web_designer_2_total_day').attr("disabled","disabled");
        $('#web_designer_2_plan_day').attr("disabled","disabled");
        $('#test_num').attr("disabled","disabled");
        $('#test_money_per_day').attr("disabled","disabled");
        $('#test_total_day').attr("disabled","disabled");
        $('#test_plan_day').attr("disabled","disabled");
    }
}

function setMode(){
    $('#pm_num').bind('input propertychange',function() {
        var text = $('input[name="pm_num"]').val();
        if(text > 0 ) {
            if($('#pm_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='pm_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='pm_money' type='number' min='0' placeholder='请输入每日单价' id='pm_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='pm_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='pm_plan_day' name='pm_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='pm_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='pm_total_day' name='pm_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#pm_add'));
            }
            //console.log($('#pm_money').length);
        } else {
            if($('#pm_money').length > 0){
                $('#pm_money').remove();
                $('#pm_total').remove();
                $('#pm_plan').remove();
            }
        }});

    $('#jszx_num').bind('input propertychange',function() {
        var text = $('input[name="jszx_num"]').val();
        if(text > 0 ) {
            if($('#jszx_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='jszx_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='jszx_money' type='number' min='0' placeholder='请输入每日单价' id='jszx_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='jszx_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='jszx_plan_day' name='jszx_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='jszx_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='jszx_total_day' name='jszx_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#jszx_add'));
            }
            //console.log($('#jszx_money').length);
        } else {
            if($('#jszx_money').length > 0){
                $('#jszx_money').remove();
                $('#jszx_total').remove();
                $('#jszx_plan').remove();
            }
        }});

    $('#app_designer_num').bind('input propertychange',function() {
        var text = $('input[name="app_designer_num"]').val();
        if(text > 0 ) {
            if($('#app_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='app_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='app_designer_money' type='number' min='0' placeholder='请输入每日单价' id='app_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='app_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='app_designer_plan_day' name='app_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='app_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='app_designer_total_day' name='app_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#app_designer_add'));
            }
            //console.log($('#app_designer_money').length);
        } else {
            if($('#app_designer_money').length > 0){
                $('#app_designer_money').remove();
                $('#app_designer_total').remove();
                $('#app_designer_plan').remove();
            }
        }});

    $('#platform_designer_num').bind('input propertychange',function() {
        var text = $('input[name="platform_designer_num"]').val();
        if(text > 0 ) {
            if($('#platform_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='platform_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='platform_designer_money' type='number' min='0' placeholder='请输入每日单价' id='platform_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='platform_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='platform_designer_plan_day' name='platform_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='platform_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='platform_designer_total_day' name='platform_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#platform_designer_add'));
            }
            //console.log($('#platform_designer_money').length);
        } else {
            if($('#platform_designer_money').length > 0){
                $('#platform_designer_money').remove();
                $('#platform_designer_total').remove();
                $('#platform_designer_plan').remove();
            }
        }});

    $('#client_designer_num').bind('input propertychange',function() {
        var text = $('input[name="client_designer_num"]').val();
        if(text > 0 ) {
            if($('#client_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='client_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='client_designer_money' type='number' min='0' placeholder='请输入每日单价' id='client_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='client_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='client_designer_plan_day' name='client_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='client_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='client_designer_total_day' name='client_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#client_designer_add'));
            }
            //console.log($('#client_designer_money').length);
        } else {
            if($('#client_designer_money').length > 0){
                $('#client_designer_money').remove();
                $('#client_designer_total').remove();
                $('#client_designer_plan').remove();
            }
        }});

    $('#web_designer_num').bind('input propertychange',function() {
        var text = $('input[name="web_designer_num"]').val();
        if(text > 0 ) {
            if($('#web_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='web_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='web_designer_money' type='number' min='0' placeholder='请输入每日单价' id='web_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='web_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='web_designer_plan_day' name='web_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='web_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='web_designer_total_day' name='web_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#web_designer_add'));
            }
            //console.log($('#web_designer_money').length);
        } else {
            if($('#web_designer_money').length > 0){
                $('#web_designer_money').remove();
                $('#web_designer_total').remove();
                $('#web_designer_plan').remove();
            }
        }});

    $('#ui_designer_num').bind('input propertychange',function() {
        var text = $('input[name="ui_designer_num"]').val();
        if(text > 0 ) {
            if($('#ui_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='ui_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='ui_designer_money' type='number' min='0' placeholder='请输入每日单价' id='ui_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='ui_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='ui_designer_plan_day' name='ui_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='ui_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='ui_designer_total_day' name='ui_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#ui_designer_add'));
            }
            //console.log($('#ui_designer_money').length);
        } else {
            if($('#ui_designer_money').length > 0){
                $('#ui_designer_money').remove();
                $('#ui_designer_total').remove();
                $('#ui_designer_plan').remove();
            }
        }});

    $('#java_designer_num').bind('input propertychange',function() {
        var text = $('input[name="java_designer_num"]').val();
        if(text > 0 ) {
            if($('#java_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='java_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='java_designer_money' type='number' min='0' placeholder='请输入每日单价' id='java_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='java_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='java_designer_plan_day' name='java_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='java_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='java_designer_total_day' name='java_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#java_designer_add'));
            }
            //console.log($('#java_designer_money').length);
        } else {
            if($('#java_designer_money').length > 0){
                $('#java_designer_money').remove();
                $('#java_designer_total').remove();
                $('#java_designer_plan').remove();
            }
        }});

    $('#andriod_designer_num').bind('input propertychange',function() {
        var text = $('input[name="andriod_designer_num"]').val();
        if(text > 0 ) {
            if($('#andriod_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='andriod_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='andriod_designer_money' type='number' min='0' placeholder='请输入每日单价' id='andriod_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='andriod_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='andriod_designer_plan_day' name='andriod_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='andriod_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='andriod_designer_total_day' name='andriod_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#andriod_designer_add'));
            }
            //console.log($('#andriod_designer_money').length);
        } else {
            if($('#andriod_designer_money').length > 0){
                $('#andriod_designer_money').remove();
                $('#andriod_designer_total').remove();
                $('#andriod_designer_plan').remove();
            }
        }});

    $('#App_designer_num').bind('input propertychange',function() {
        var text = $('input[name="App_designer_num"]').val();
        if(text > 0 ) {
            if($('#App_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='App_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='App_designer_money' type='number' min='0' placeholder='请输入每日单价' id='App_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='App_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='App_designer_plan_day' name='App_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='App_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='App_designer_total_day' name='App_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#App_designer_add'));
            }
            //console.log($('#App_designer_money').length);
        } else {
            if($('#App_designer_money').length > 0){
                $('#App_designer_money').remove();
                $('#App_designer_total').remove();
                $('#App_designer_plan').remove();
            }
        }});

    $('#C_designer_num').bind('input propertychange',function() {
        var text = $('input[name="C_designer_num"]').val();
        if(text > 0 ) {
            if($('#C_designer_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='C_designer_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='C_designer_money' type='number' min='0' placeholder='请输入每日单价' id='C_designer_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='C_designer_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='C_designer_plan_day' name='C_designer_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='C_designer_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='C_designer_total_day' name='C_designer_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#C_designer_add'));
            }
            //console.log($('#C_designer_money').length);
        } else {
            if($('#C_designer_money').length > 0){
                $('#C_designer_money').remove();
                $('#C_designer_total').remove();
                $('#C_designer_plan').remove();
            }
        }});

    $('#web_designer_2_num').bind('input propertychange',function() {
        var text = $('input[name="web_designer_2_num"]').val();
        if(text > 0 ) {
            if($('#web_designer_2_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='web_designer_2_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='web_designer_2_money' type='number' min='0' placeholder='请输入每日单价' id='web_designer_2_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='web_designer_2_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='web_designer_2_plan_day' name='web_designer_2_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='web_designer_2_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='web_designer_2_total_day' name='web_designer_2_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#web_designer_2_add'));
            }
            //console.log($('#web_designer_2_money').length);
        } else {
            if($('#web_designer_2_money').length > 0){
                $('#web_designer_2_money').remove();
                $('#web_designer_2_total').remove();
                $('#web_designer_2_plan').remove();
            }
        }});

    $('#test_num').bind('input propertychange',function() {
        var text = $('input[name="test_num"]').val();
        if(text > 0 ) {
            if($('#test_money').length <= 0){
                //console.log(text);
                $("<div class='layui-form-item' id='test_money'><label for='username' class='layui-form-label'>每日单价</label> <div class='layui-input-inline'><input name='test_money' type='number' min='0' placeholder='请输入每日单价' id='test_money_per_day' autocomplete='off' class='layui-input'></div></div>"+
                    "<div class='layui-form-item' id='test_plan'><label for='username' class='layui-form-label'>实施计划安排人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计划人日' id='test_plan_day' name='test_plan_day' autocomplete='off' class='layui-input'></div></div>" +
                    "<div class='layui-form-item' id='test_total'><label for='username' class='layui-form-label'>财务计价不含税人日</label><div class='layui-input-inline'> <input type='number' min='0' placeholder='请输入计价人日' id='test_total_day' name='test_total_day' autocomplete='off' class='layui-input'></div></div>").appendTo($('#test_add'));
            }
            //console.log($('#test_money').length);
        } else {
            if($('#test_money').length > 0){
                $('#test_money').remove();
                $('#test_total').remove();
                $('#test_plan').remove();
            }
        }});
}
function isEmpty(val){
    if(val == null || val == undefined || val == ''){
        return null;
    } else {
        return val;
    }
}
